//
//  FastLookViewCell.m
//  LOL
//
//  Created by lanou3g on 15/11/19.
//  Copyright © 2015年 syx. All rights reserved.
//

#import "FastLookViewCell.h"
#import <UIImageView+WebCache.h>
#import "FastLookModel.h"

@interface FastLookViewCell ()

@property (nonatomic,strong) UIImageView * groyBackView;
@property (nonatomic,strong) UIImageView * whiteBackView;
@property (nonatomic,strong) UILabel * titleLabel;
@property (nonatomic,strong) UILabel * descLabel;
@property (nonatomic,strong) UILabel * dateLabel;
@property (nonatomic,strong) UIImageView * titleImageView;

@end

@implementation FastLookViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setupSubViews];
    }
    return self;
}


- (void)setupSubViews{
    
    self.groyBackView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 135)];
    self.groyBackView.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [self.contentView addSubview:self.groyBackView];
    
    self.whiteBackView = [[UIImageView alloc]initWithFrame:CGRectMake(5, 0, [UIScreen mainScreen].bounds.size.width - 10, 130)];
    self.whiteBackView.backgroundColor = [UIColor whiteColor];
    self.whiteBackView.layer.cornerRadius = 5;
    [self.groyBackView addSubview:self.whiteBackView];
    
    self.titleImageView = [[UIImageView alloc]initWithFrame:CGRectMake(5, 5, 90, 90)];
    [self.whiteBackView addSubview:self.titleImageView];
    
    self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(100, 0, self.whiteBackView.frame.size.width - 110, 55)];
    self.titleLabel.numberOfLines = 0;
    self.titleLabel.font = [UIFont systemFontOfSize:16];
    [self.whiteBackView addSubview:self.titleLabel];
    
    self.descLabel = [[UILabel alloc]initWithFrame:CGRectMake(100, 55, self.whiteBackView.frame.size.width  - 110, 45)];
    self.descLabel.numberOfLines = 0;
    self.descLabel.font = [UIFont systemFontOfSize:16];
    self.descLabel.textColor = [UIColor lightGrayColor];
    [self.whiteBackView addSubview:self.descLabel];
    
    self.dateLabel = [[UILabel alloc]initWithFrame:CGRectMake(130, 110, 200, 20)];
    self.dateLabel.font = [UIFont systemFontOfSize:14];
    self.dateLabel.textColor = [UIColor lightGrayColor];
    [self.whiteBackView addSubview:self.dateLabel];
    
}

- (void)setupViewsWithModel:(FastLookModel *)fastLookModel{
    self.titleLabel.text = fastLookModel.title;
    self.descLabel.text = fastLookModel.summary;
    self.dateLabel.text = fastLookModel.insert_date;
    [self.titleImageView sd_setImageWithURL:[NSURL URLWithString:fastLookModel.image_url_big] placeholderImage:nil];
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
